#include<bits/stdc++.h>
using namespace std;
int n,l,r;
int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%d%d%d",&n,&l,&r);
	int t1=l%n;
	int t2=r%n;
	int t3=(r-l)/n;
	int ans;
	if(t3>=1||t3==0&&t1>t2) ans=n-1;
	else ans=t2;
	printf("%d",ans);
}
